///분판효과

uniform float   noEffectCenter; //如果值为1.0，则设置中心部分以便不产生分离效果。
uniform float   strokeSizeR;
uniform float   strokeSizeG;
uniform float   strokeSizeB;

uniform float   verticalMove; //垂直运动 上下
uniform float   horizontalMove; //水平运动

void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
    
    vec2 texCoord = fragCoord.xy / iResolution.xy;

    float uv = (verticalMove != 0.0) ? texCoord.y : texCoord.x;
    float scale = 1.0;
    if(noEffectCenter == 1.0)
    {
        scale = mix(0.5 - uv, uv - 0.5, step(0.5, uv)) * 2.0;
    }

    vec2 texelSize_R = vec2(horizontalMove, verticalMove) * strokeSizeR * scale;
    vec2 texelSize_G = vec2(horizontalMove, verticalMove) * strokeSizeG * scale;
    vec2 texelSize_B = vec2(horizontalMove, verticalMove) * strokeSizeB * scale;

    float r = texture2D(iChannel0, texCoord - texelSize_R).r;
    float g = texture2D(iChannel0, texCoord - texelSize_G).g;
    float b = texture2D(iChannel0, texCoord - texelSize_B).b;
    
    fragColor = vec4(r, g, b, 1.0);

}
